#include"Runga-Kutta.h"


int main(int argc , char *argv[]){

 int i;
 double y;
 double h;
 double F1,F2,F3,F4;
 
 
 Runga_Kutta rk(0,3);
 
    
 rk.setH(0.25);
 rk.setInitialY0(1); 
 h=0.25;
      
    cout<< " h = "<<rk.getH()<<"  x = "<<rk.getX()<<"  y = "<<rk.getY()<<endl;   
     
    for(i=0;rk.getX()<3;i++){
    
      F1 =  rk.getF( rk.getX() , rk.getInitialY0() );
      //cout<<" F1 = "<<F1;
      
      F2 =  rk.getF( rk.getX() + ( rk.getH() / 2 ) , rk.getInitialY0() + ( (rk.getH() / 2 ) * F1 )  );
     // cout<<" F2 = "<<F2;
      
      F3 =  rk.getF( rk.getX() + ( rk.getH() / 2 ) , rk.getInitialY0() + ( (rk.getH() / 2 ) * F2 )  );   
     // cout<<" F3 = "<<F3;
      
      F4 =  rk.getF( rk.getX() + rk.getH() , rk.getInitialY0() + ( F3 * h)  );
     // cout<<" F4 = "<<F4<<endl;
      
         
        y = rk.getInitialY0() + ( h / 6 * ( F1 + 2*F2 + 2*F3 + F4 ) );
	
	cout << "x = " << rk.getX()<< " y = "<< rk.getInitialY0()<<endl;
	  

	
           rk.setX( rk.getX() + h );  
           rk.setY( y );
           rk.setInitialY0( y );   
	   
    } 

    
    cout<<"Number Of Step Count  "<<i;
}

